<?php
require('header.php');

if(isset($_REQUEST['title']) && isset($_REQUEST['note'])) {
    $title=$_REQUEST['title'];
    $note=$_REQUEST['note'];
    $sql="INSERT INTO notes (title,note) VALUES('$title','$note') ";
    mysql_query($sql) or die("Can not add to database");
    $add_note=1;
}

?>
	<h1>Add a new note</h1>
	<hr>

    <?php
    if(isset($add_note)) {
        echo '<div class="alert alert-success">New Note <u>'.$title.'</u> Added!</div>';
    }
    ?>
    
    
	<form method="post" action="<?=$_SERVER['PHP_SELF'];?>">
		<label>Title</label>
		<input type="text" name="title" placeholder="Note Title" class="span4">
		<label>Note</label>
        <textarea name="note" class="span8" rows="15"></textarea>
        <hr>
        <input type="submit" name="submit" value="Submit" class="btn-primary btn-large">
    </form>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap-transition.js"></script>
    <script src="assets/js/bootstrap-alert.js"></script>
    <script src="assets/js/bootstrap-modal.js"></script>
    <script src="assets/js/bootstrap-dropdown.js"></script>
    <script src="assets/js/bootstrap-scrollspy.js"></script>
    <script src="assets/js/bootstrap-tab.js"></script>
    <script src="assets/js/bootstrap-tooltip.js"></script>
    <script src="assets/js/bootstrap-popover.js"></script>
    <script src="assets/js/bootstrap-button.js"></script>
    <script src="assets/js/bootstrap-collapse.js"></script>
    <script src="assets/js/bootstrap-carousel.js"></script>
    <script src="assets/js/bootstrap-typeahead.js"></script>
    <script src="assets/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript" >
		tinyMCE.init({
        mode : "textareas",
        theme : "simple"   //(n.b. no trailing comma, this will be critical as you experiment later)
		});
	</script >
  </body>
</html>
